#ifndef _GLOBALDEFINES_H
#define _GLOBALDEFINES_H

#include <complex>
#include <cmath>
#include <blitz/array.h>
#include <blitz/tinyvec-et.h>
#include <set>
#include <vector>
#include <string>

typedef double real_data;
typedef std::complex<real_data> dComplex;
typedef blitz::TinyVector<real_data,2> Position2D;
typedef blitz::TinyVector<real_data,3> Position3D;
typedef blitz::TinyVector<dComplex,3> Complex3D;
typedef blitz::TinyVector<int,4> Int4;
typedef blitz::TinyVector<int,3> Int3;

const real_data SQRT3 = sqrt(3.0);
const real_data PI = 2*asin(1.0);
const real_data Epsilon = 8.854187817e-12;
const real_data Mu = PI*4e-7;
const real_data C = 1/sqrt(Epsilon*Mu);
const int Itmax = 10000;
const real_data ALPHA = 1;

class SingularInt													// Used in singular integral
{
public:
	real_data Ds;
	Position3D R0;
	Position3D Rho0;
	Position3D Rhod;
	Position3D Rhoxd;
	real_data Ri1;
	Position3D Ri1p;
	real_data Ri3;
	Position3D Ri3p;
};

class State															// Used in matrix calculation
{
public:
	int Patch_Fld;													// Field patch's No.
	int Patch_Src;													// Source patch's No.
	bool Near_Edge;													// Whether source edge and field edge are near edges
	bool Near_Patch;												// Whether source patch and field patch are near patches
	real_data Fld2Src;												// Distance from source patch's integral point to field patch's integral point
	real_data Agu;													// Phase angle, which is kr in exp(-j kr)
};

#endif